<!--
 * @Descripttion: 
 * @Author: 柳绪良
 * @Date: 2021-07-30 10:14:51
 * @LastEditors: 柳绪良
 * @LastEditTime: 2021-08-03 09:52:06
-->
<template>
  <div class="container">
    <el-dialog
      title="预览文章"
      :visible.sync="isShowDialog"
      width="800px"
      @open="open"
      :before-close="handleClose"
    >
     <div class="title">
          <h2>{{myData.title}}</h2>
          <div>
            <span>{{myData.createTime|parseTimeByString}}</span>
            <span>{{myData.username}}</span>
            <span class="el-icon-view"></span>
            <span>{{myData.visits}}</span>
          </div>
        </div>
        <div class="content" v-html="myData.articleBody"></div>
    </el-dialog>
  </div>
</template>

<script>
import {detail} from '@/api/hmmm/articles'
export default {
  props: ["data", "isShowDialog"],
  data() {
    return {
      isVeido: false,
      myData: {}
    }
  },
  methods: {
    async open() {
      const res = await detail({ id: this.data.id })
      this.myData = res.data
    },
    handleClose() {
      this.$emit('closeDialog')
    },
  }
};
</script>

<style scoped lang='less'>
.container {
  .title{
  border-bottom: 1px dashed #ccc;
  padding-bottom: 10px;
  h2 {
    padding: 0;
    margin: 0;
  }
  span{
    margin-left: 10px;
    margin-top: 10px;
  }
}
.content{
  background: #f5f5f5;
  padding: 10px;
}
}
</style>
